<script type="text/javascript" src="jquery-1.7.1.js"></script>
<script type="text/javascript" src="highcharts.js"></script>
<script type="text/javascript" src="exporting.js"></script>
<script type="text/javascript">
	/**
		 * Visualize an HTML table using Highcharts. The top (horizontal) header 
		 * is used for series names, and the left (vertical) header is used 
		 * for category names. This function is based on jQuery.
		 * @param {Object} table The reference to the HTML table to visualize
		 * @param {Object} options Highcharts options
		 */
		Highcharts.visualize = function(table, options) {
		   // the categories
		   options.xAxis.categories = [];
		   $('tbody th', table).each( function(i) {
			  options.xAxis.categories.push(this.innerHTML);
		   });
		   
		   // the data series
		   options.series = [];
		   $('tr', table).each( function(i) {
			  var tr = this;
			  $('th, td', tr).each( function(j) {
				 if (j > 0) { // skip first column
					if (i == 0) { // get the name and init the series
					   options.series[j - 1] = { 
						  name: this.innerHTML,
						  data: []
					   };
					} else { // add values
					   options.series[j - 1].data.push(parseFloat(this.innerHTML));
					}
				 }
			  });
		   });
		   
		   var chart = new Highcharts.Chart(options);
		}
		   
		// On document ready, call visualize on the datatable.
		$(document).ready(function() {         
		   var table = document.getElementById('datatable'),
		   options = {
				 chart: {
					renderTo: 'container',
					defaultSeriesType: 'column',
					width: '860',
					height: '280',
					backgroundColor: "",
					borderColor: "#FFFFFF",				
				 },
				 title: {
					text: 'Grafik Perbandingan Target dan Relisasi Retribusi',
					style: {
						color: '#000000',
						fontWeight: 'bold'
					}
				 },
				 xAxis: {
				 	title: {
					   text: '',					   
					   style: {
							color: '#000000',
							fontWeight: 'bold'
						}				   
					},
					labels: {
						style: {
							color: '#000000'
						}
					}
				 },
				 yAxis: {
					title: {
					   text: 'Jumlah'
					},	
					labels: {
						style: {
							color: '#000000'
						}
					}				
				 },				 
				 tooltip: {
					formatter: function() {
					   return '<b>'+ this.series.name +'</b><br/>'+
						  this.y +' '+ this.x.toLowerCase();
					}
				 }
			  };
		   
							 
		   Highcharts.visualize(table, options);
		});
</script>
<html>
<head>
<title></title>
<head>
<body>
                    <div id="container" style="width: 860px; height: 400px; margin: 0 auto"></div>
                    <table id="datatable" style="display: none;">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Jumlah Surat Izin</th>
                            </tr>
                        </thead>
                                <tbody>				
                                    <tr>
                                        <th>Daerah Subang Jawa Barat</th>
                                        <td>13</td>
                                    </tr>	
                                    <tr>
                                        <th>Daerah Jakarta Selatan</th>
                                        <td>16</td>
                                    </tr>	
                                    <tr>
                                        <th>Daerah Jakarta Selatan</th>
                                        <td>12</td>
                                    </tr>	
                                    <tr>
                                        <th>Daerah Bandung Kaler</th>
                                        <td>22</td>
                                    </tr>	
                                    <tr>
                                        <th>Daerah Cibenda</th>
                                        <td>15</td>
                                    </tr>	
                                    <tr>
                                        <th>Daerah Jakarta Selatan</th>
                                        <td>12</td>
                                    </tr>	
                                    <tr>
                                        <th>Daerah Bandung Kaler</th>
                                        <td>22</td>
                                    </tr>	
                                    <tr>
                                        <th>Daerah Cibenda</th>
                                        <td>15</td>
                                    </tr>									
                                </tbody>
								
                    </table>                    
</body>
</html>